<template>
  <CellGroup class="mr15 ml15">
    <Cell v-for="item in list" v-show="isMobile||item.key!=='set'" :key="item" is-link :icon="item.icon" :title="item.title" @click="handleCell(item)"/>
  </CellGroup>
  <Popup  v-model:show="showCenter" round class="p20">
    <div>问题反馈：<a rel="nofollow" href="tel:0755-8328836">0755-8328836</a></div>
  </Popup>
</template>
<script setup>
import {CellGroup, Cell, Popup} from 'vant'
import { computed, ref } from 'vue'
import {wxPageRedirect} from '@/utils/common.js'
import { useRouter } from 'vue-router'
import { commonStore } from "@/stores/common.js";
import { storeToRefs } from "pinia";

const showCenter = ref(false)
const popupMsg = ref()
const router = useRouter()
const { isMobile } = storeToRefs(commonStore());

const list = ref([
    {title: '消息通知', icon:'chat-o', key:'', link:'CenterMessage'},
    {title: '问题反馈', icon:'smile-comment-o', key:'', popupMsg:'问题反馈：0755-8328836'},
    {title: '设置', icon:'setting-o', key:'set', weappLink:'../accountInfo/accountInfo'},
])
// 点击列
const handleCell = (item) => {
  if(item.weappLink) return wxPageRedirect(item.weappLink)
  if(item.popupMsg) {
    showCenter.value = true;
    popupMsg.value = item.popupMsg;
  }
  if(item.link) { router.push({name: item.link})}
}
</script>
<style scoped>
.list_center{
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.list_center_title{
  flex: 1;
  text-align: left;
  padding-left: .5rem;
  color: var(--van-text-color)
}
</style>